from redis import StrictRedis


class Config:
    DEBUG = None
    REDIS_HOST = '127.0.0.1'
    REDIS_POST = 6379
    SECRET_KEY = '4mkxBI2VOAoXWZ95olVVRsjEU0fTMzH7rGMfciZOTI+uOa4+fMeCSw=='

    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@127.0.0.1:3306/INformation'
    # 动态追踪修改设置，如未设置只会提示警告
    SQLALCHEMY_TRACK_MODIFICATIONS = False

    # 配置redis数据库， 用来存储session,实现状态保持
    SESSION_TYPE = 'redis'
    # 设置签名
    SESSION_USE_SIGNER = True
    # 设置session 有效期,永久会话过期时间
    PERMANENT_SESSION_FILETIME = 86400
    # redis 数据库实例化
    StrictRedis(host=REDIS_HOST, port=REDIS_POST)


# 定义开发模式下的配置
class DevelopmentConfig(Config):
    DEBUG = True


# 定义生产模式下的配置
class ProductionConfig(Config):
    DEBUG = False

config = {
    'development': DevelopmentConfig,
    'production': ProductionConfig
}